10 REM CHEBYSHEV ARRAY SYNTHESIS
20 REM "ANTENNA DESIGN USING PERSONAL COMPUTERS"
30 DIM I(50),IT(100)
40 PI=3.14159
50 DEF FNLOG10(X)=.4343*LOG(X)
60 KEY OFF
70 CLS
80 SCREEN 0,1
90 COLOR 1,0
100 PRINT "THIS PROGRAM COMPUTES THE CHEBYSHEV COEFFICIENTS FOR AN N-ELEMENT"
110 PRINT "LINEAR ARRAY, WITH A SPECIFIED SIDELOBE LEVEL."
120 COLOR 4,0
130 PRINT
140 INPUT "HOW MANY ELEMENTS IN THE ARRAY";M
150 INPUT "WHAT IS THE SPACING BETWEEN ELEMENTS(WAVELENGTHS)";D
160 INPUT "WHAT IS THE DESIRED SIDELOBE LEVEL(+dB)";RDB
170 COLOR 14,0
180 PRINT
190 REM FIGURE IF EVEN OR ODD NUMBER OF ELEMENTS
200 IEVEN=0
210 IF 2*INT(M/2)=M THEN IEVEN=1
220 REM COMPUTE X0
230 R=10^(RDB/20)
240 X0=LOG(R+SQR(R*R-1))/(M-1)
250 X0=.5*(EXP(X0)+EXP(-X0))
260 ALP=1-1/X0^2
270 IF IEVEN=0 THEN GOTO 460
280 REM EVEN NUMBER OF ELEMENTS
290 N=M/2
300 FOR LN=1 TO N-1
310 NP=1
320 FOR LM=1 TO LN-1
330 FM=LM*(M-1-2*LN+LM)/((LN-LM)*(LN+1-LM))
340 NP=NP*ALP*FM+1
350 NEXT LM
360 I(N-LN)=(M-1)*ALP*NP
370 NEXT LN
380 I(N)=1
390 REM FILL INTO IT AND NORMALIZE
400 IN=I(1)
410 FOR J=1 TO N
420 IT(J)=I(N+1-J)/IN
430 IT(M+1-J)=IT(J)
440 NEXT J
450 GOTO 640
460 REM ODD NUMBER OF ELEMENTS
470 N=(M-1)/2
480 FOR LN=1 TO N
490 NP=1
500 FOR LM=1 TO LN-1
510 FM=LM*(M-1-2*LN+LM)/((LN-LM)*(LN+1-LM))
520 NP=NP*ALP*FM+1
530 NEXT LM
540 I(N-LN)=(M-1)*ALP*NP
550 NEXT LN
560 I(N)=1
570 REM FILL IT AND NORMALIZE
580 IN=I(0)
590 IT(N+1)=1
600 FOR J=1 TO N
610 IT(J)=I(N+1-J)/IN
620 IT(M+1-J)=IT(J)
630 NEXT J
640 PRINT "ELEMENT     COEFF(ABS)   COEFF(dB)"
650 FOR J=1 TO M
660 ITDB=20*FNLOG10(IT(J))
670 PRINT USING "   ##         #.#####     ###.##";J,IT(J),ITDB
680 NEXT J
690 PRINT
700 REM COMPUTE DIRECTIVITY, BEAMWIDTH
710 F=1
720 IF RDB<22 THEN GOTO 770
730 X0=LOG(R+SQR(R*R-1))
740 X0=SQR(X0*X0-PI*PI)
750 F=.5*(EXP(X0)+EXP(-X0))
760 F=1+.636*(2*F/R)^2
770 DT=2*R*R/(1+(R*R-1)*F/(M*D))
780 DTDB=10*FNLOG10(DT)
790 BW=101.5/DT
800 PRINT USING "THE DIRECTIVITY IS ##.## dB";DTDB
810 PRINT USING "THE 3-dB BEAMWIDTH IS ###.# degrees";BW
820 PRINT
830 COLOR 4,0
840 INPUT "DO YOU WISH TO PLOT THE PATTERN(Y,N)";IP$
850 IF IP$="N" THEN GOTO 1300
860 REM PLOT PATTERN
870 SCREEN 2,0
880 VIEW (262,3)-(638,182)
890 WINDOW (-2,-56)-(92,0)
900 FOR J=0 TO 90 STEP 10
910 LINE (J,-50)-(J,-51)
920 NEXT J
930 LINE (90,-50)-(0,-50)
940 FOR J=0 TO -50 STEP -10
950 LINE (0,J)-(-2,J)
960 NEXT J
970 LINE (0,0)-(0,-50)
980 LOCATE 23,55
990 PRINT "THETA"
1000 FOR I=0 TO 5
1010 LOCATE 1+I*4,30
1020 PRINT USING "###";-10*I
1030 NEXT I
1040 LOCATE 11,28: PRINT "dB"
1050 LOCATE 22,35
1060 PRINT"0   10   20   30   40   50   60   70   80   90"
1070 KD=2*PI*D
1080 DTR=PI/180
1090 NL=N
1100 IF IEVEN=0 THEN NL=N+1
1110 PSET (0,0)
1120 FOR TH=0 TO 90
1130 STH=SIN(TH*DTR)
1140 F=0
1150 FOR J=1 TO NL
1160 IF IEVEN=0 THEN C=J-1
1170 IF IEVEN=1 THEN C=J-.5
1180 CI=IT(NL+1-J)
1190 IF J=1 AND IEVEN=0 THEN CI=CI/2
1200 F=F+CI*COS(C*KD*STH)
1210 NEXT J
1220 F=ABS(F)
1230 IF TH=0 THEN FMAX=F
1240 F=F/FMAX
1250 IF F<.00316 THEN F=.00316
1260 F=20*FNLOG10(F)
1270 LINE -(TH,F)
1280 NEXT TH
1290 LOCATE 1,1
1300 INPUT "CONTINUE(Y,N)";IP$
1310 IF IP$<>"N" THEN GOTO 70
1320 SCREEN 0,1
1330 COLOR 7,0
1340 KEY ON
1350 END
